﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true"
    CodeBehind="Country.aspx.cs" Inherits="CSPTest.Admin.Country" %>


<asp:Content ContentPlaceHolderID="HeadContent" runat="server">
    <link href="../content/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />
    <link href="../content/entity.css" rel="stylesheet" type="text/css" />

    <script src="../js/jquery-1.4.4.min.js" type="text/javascript"></script>

    <script src="../js/jquery-ui.min.js" type="text/javascript"></script>

    <script type="text/javascript">
        $(function() {
            $("input:submit,input:button").button();

            $(".entity-delete a")
                .attr("title", "Delete")
                .bind("click", function() {
                    return confirm("Are you sure to delete this item?");
                });

            $(".entity-modify a")
                .attr("title", "Modify");
        });
    </script>

</asp:Content>
<asp:Content ContentPlaceHolderID="MainContent" runat="server">
    <div>
        <h1>
            Country Management</h1>
        <asp:TextBox ID="SearchText" runat="server"></asp:TextBox>
        <asp:Button runat="server" ToolTip="Search by the keywords" Text="Search" />
        <asp:Button runat="server" ToolTip="Clear all the search keywords" Text="Clear" ID="BtnClear" />
        
        <asp:GridView ID="gvMain" runat="server" AutoGenerateColumns="False" DataKeyNames="CountryID"
            DataSourceID="edsMain" AllowPaging="True" AllowSorting="True" EmptyDataText="没有数据">
            <Columns>
                <asp:BoundField DataField="CountryID" HeaderText="CountryID" ReadOnly="True" SortExpression="CountryID" />
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                
           
                <asp:TemplateField HeaderText="CreatedBy">
                    <ItemTemplate>
                        <%#EvalX("CreatedBy.DisplayName") %></ItemTemplate>
                </asp:TemplateField>
                
                <asp:BoundField DataField="CreatedTime" HeaderText="CreatedTime" SortExpression="CreatedTime" />

           
                <asp:TemplateField HeaderText="CreatedBy">
                    <ItemTemplate>
                        <%#EvalX("LastModifiedBy.DisplayName") %></ItemTemplate>
                </asp:TemplateField>

                <asp:BoundField DataField="LastModifiedTime" HeaderText="LastModifiedTime" SortExpression="LastModifiedTime" />
              
                
                <asp:ButtonField CommandName="Modify" ButtonType="Link" ItemStyle-CssClass="entity-modify" />
                <asp:ButtonField CommandName="Disable" ButtonType="Link" ItemStyle-CssClass="entity-delete" />
            </Columns>
        </asp:GridView>
        <asp:Button ID="BtnAdd" runat="server" Text="Add" />
        <asp:DetailsView ID="dvMain" runat="server" AutoGenerateRows="False" DataKeyNames="CountryID"
            DataSourceID="edsMain">
            <Fields>
                <asp:BoundField DataField="CountryID" HeaderText="RoleID" ReadOnly="True" SortExpression="RoleID" />
                <asp:BoundField DataField="Name" HeaderText="Name" SortExpression="Name" />
                <asp:CommandField ShowEditButton="True" ShowInsertButton="True" ButtonType="Button" />
            </Fields>
        </asp:DetailsView>
        
        <%--以下是数据源--%>
        <asp:EntityDataSource ID="edsMain" runat="server" ConnectionString="name=CSPEntities"
            DefaultContainerName="CSPEntities" EnableInsert="True" EnableUpdate="True" EntitySetName="Countries"
            Include="CreatedBy,LastModifiedBy" Where="(!it.Disabled)">
        </asp:EntityDataSource>
     
    </div>
</asp:Content>
